const {defineConfig} = require('@vue/cli-service')
const CompressionPlugin = require('compression-webpack-plugin')
let webpack = require('webpack')
module.exports = defineConfig({
    transpileDependencies: true,
    lintOnSave: false,   //关闭eslint校验
    productionSourceMap: false, //在生产模式中禁用 Source Map，既可以减少包大小，也可以加密源码
    configureWebpack: {
        // disable performance hints
        performance: {
            hints: false
        },
        plugins: [
            new webpack.optimize.MinChunkSizePlugin({minChunkSize: 10000}),
            new CompressionPlugin({
                test: /\.js$/,
                algorithm: 'gzip',
                threshold:10240,
                minRatio:0.8,
                deleteOriginalAssets:false
            })
        ],
        // module:{
        //     rules:[
        //         {
        //             test:/\.html$/,
        //             use:[
        //                 {
        //                     loader:'html-loader',
        //                 }
        //             ]
        //         }
        //     ]
        // }
    },

    publicPath: process.env.NODE_ENV === 'production' ? '/' : '/',

    outputDir: 'dist',
    crossorigin: "anonymous",
    devServer: {
        host: '0.0.0.0',
        port: 8888,
        open: true,
        client:{
            overlay:false
        },
        proxy: {
            '/api': {
                target: `http://180.101.182.53:8090`,
                changeOrigin: true
            },
            '/whisper': {
                target: `http://180.101.182.53:8090`,
                changeOrigin: true
            }
        }
    }
})
